package com.wits.qso.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import net.sf.json.JSONObject;

import com.wits.platform.entity.BaseEntity;

@Entity
@Table(name="qso_material_d")
public class MaterialD  extends BaseEntity
{
	private String id = null;
	private String intro = null;
	private int ord = 0;
	private String path = null;
	private float sizs = 0f;
	private String title = null;
	private String type = null;
	private String upId = null;
	private String uri = null;
	private String mtrhId = null;
	
	public MaterialD() { super(); }
	
	@Id
	@GenericGenerator(name = "idGen", 
					strategy = "com.wits.platform.common.id.generator.IDGenerator",
					parameters={ 
								@Parameter(name = "segment_value", value = "QSO_MTRD_ID"), 
								@Parameter(name="table_name",value="wits_id_generator"),
								@Parameter(name="value_column_name",value="gen_value"),
								@Parameter(name="segment_column_name",value="gen_name"),
								@Parameter(name="segment_value_length",value="5"),
								@Parameter(name="sq_format",value="%03d"), 
								@Parameter(name="sq_prefix",value="CL") 
					})
	@GeneratedValue(generator = "idGen")
	@Column(name = "mtrd_id", nullable = false, insertable = true, updatable = false, length = 10)
	public String getId() {
		return id;
	}

	@Column(name="mtrd_intro", nullable = false, length = 500)
	public String getIntro() {
		return intro;
	}

	@Column(name="mtrd_ord", nullable = false)
	public int getOrd() {
		return ord;
	}

	@Column(name="mtrd_path", nullable = false, length = 100)
	public String getPath() {
		return path;
	}

	@Column(name="mtrd_sizs", nullable = false)
	public float getSizs() {
		return sizs;
	}

	@Column(name="mtrd_title", nullable = false, length = 100)
	public String getTitle() {
		return title;
	}

	@Column(name="mtrd_type", length = 2)
	public String getType() {
		return type;
	}

	@Column(name="mtrd_upid", nullable = false, length = 10)
	public String getUpId() {
		return upId;
	}

	@Column(name="mtrd_uri", nullable = false, length = 100)
	public String getUri() {
		return uri;
	}
	
	@Column(name="mtrh_id", nullable = false, length = 10)
	public String getMtrhId() {
		return mtrhId;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	public void setOrd(int ord) {
		this.ord = ord;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public void setSizs(float sizs) {
		this.sizs = sizs;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setUpId(String upId) {
		this.upId = upId;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}

	public void setMtrhId(String mtrhId) {
		this.mtrhId = mtrhId;
	}

	@Override
	public String display() {
		return null;
	}
	
	@Override
	public String toString(){
		return JSONObject.fromObject(this, MaterialD.getBaseJsonConfig()).toString();
	}
}
